<!DOCTYPE html>
<html lang="en">
<head xmlns:th="http://www.thymeleaf.org">
    <meta charset="UTF-8">
    <title>用户身份认证</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <script src="/js/jquery.js"></script>
    <link rel="stylesheet" href="/plugins/bootstraptable/bootstrap-table.min.css">
    <style>
        b{
            font-weight: bolder;
            color: blue;
        }
    </style>
</head>
<body>
<div class="container-fluid">
    <div class="panel panel-default">
        <div class="panel-heading">panal</div>
        <div class="panel-body">
            <form>
                <div class="form-group">
                    <label for="username">用户名：</label>
                    <input type="text" class="form-control" id="username" name="username" placeholder="用户名">
                </div>
                <div class="form-group">
                    <label for="password">Password</label>
                    <input type="password" class="form-control" id="password"  name="password" placeholder="密码">
                </div>
                <button type="button" class="btn btn-default" onclick="login();">认证</button>
            </form>
        </div>

    </div>

</div>
<script type="text/javascript">
    function login(){
        var name=$("#username").val();
        var password=$("#password").val();
        $.ajax({
            url:"/webapi/login/user",
            data:{
                username:name,
                password:password
            }
        }).done(function (rs){
            if (rs>=0){
                //成功
                window.location.href="/student/list";
            }
            else{
                alert("认证失败，用户名或者密码错误！");
            }
        })
    }
</script>


</body>
</html>